package com.geekaca.exam;

import java.util.Scanner;

public class Test1 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        System.out.println("输入存款金额:");
        int money = scanner.nextInt();
        System.out.println("请输入存款年限:");
        int year = scanner.nextInt();
        double totals = saves(money,year);
        System.out.println("存"+year+"年"+"本息总额="+totals+"元");

    }

    public static double saves(int money, int year) {
        switch (year) {
            case 1:
                return money + money * 0.0225;
            case 2:
                return money + money * 0.027;

            case 3:
                return money + money * 0.0325;

            case 5:
                return money + money * 0.036;

            default:
                System.out.println("年限录入错误.");
                return 0;
        }
    }
}
